version 6.0 	/* version of STATA used */

/* This file creates some variables that will be used in subsequent models*/

gen baltic = code
recode baltic 939 941 946 = 1 *=0
gen balkan = code
recode balkan 914 918 960 961 962 968 = 1 *=0
gen casia = code
recode casia 911 912 915 916 917 923 925 927 948 = 1 *=0
gen restussr = code
recode restussr 913 921 922 926 = 1 *=0
gen upto1993 = year
recode upto1993 1990/1993 = 1 *=0

gen ParlXel2 = Elect_yn*Parlelec
gen ExecXel2 = Executiv*ParlXel2

gen USODA=USEcon+USMil
gen oecd=OECD-USEcon

tsset code count

gen IMFlag = l.IMFstat
gen CHRSL1 = l.CHRS
gen CHERL1 = l.CHER
gen CHDCL1 = l.CHDC
gen CPIL1 = l.CPI
gen CPIL6 = l6.CPI
gen CPILSQ=CPIL1^2
gen CHDCLSQ=CHDCL1^2
gen CHERLSQ=CHERL1^2

sort year month
by year month: generate AVGCHDC = sum(CHDC)/sum(CHDC~=.)
by year month: replace AVGCHDC = AVGCHDC[_N]
by year month: generate AVGCPI = sum(CPI)/sum(CPI~=.)
by year month: replace AVGCPI = AVGCPI[_N]
by year month: generate AVGCHER = sum(CHER)/sum(CHER~=.)
by year month: replace AVGCHER = AVGCHER[_N]

gen IMFQuota = IMFstat*Quota
gen IMFParts = IMFstat*Partisan
gen IMFnump = IMFstat*numpart
gen IMFseatl = IMFstat*seatlar
gen IMFParl2 = IMFstat*ParlXel2
gen IMFdem = IMFstat*FHdem
gen IMFUSAID = IMFstat*USAID
gen IMFUSODA = IMFstat*USODA
gen IMFoecd = IMFstat*oecd
gen IMFCHRSL = IMFstat*CHRSL1
gen IMFCHDCL = IMFstat*CHDCL1
gen IMFCPIL1 = IMFstat*CPIL1
gen IMFCPIL6 = IMFstat*CPIL6
gen IMFecon=USEcon*IMFstat
gen IMFmil=USMil*IMFstat

